home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / gcc.info-3 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  47.6 KB  |  1,159 lines

  1. This is Info file gcc.info, produced by Makeinfo version 1.68 from the
  2. input file ./gcc.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * gcc: (gcc).                  The GNU Compiler Collection.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU compiler.
  9.  
  10.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  11. Boston, MA 02111-1307 USA
  12.  
  13.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  14. 1999, 2000 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License" and "Funding
  23. for Free Software" are included exactly as in the original, and
  24. provided that the entire resulting derived work is distributed under
  25. the terms of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that the sections entitled "GNU General Public
  30. License" and "Funding for Free Software", and this permission notice,
  31. may be included in translations approved by the Free Software Foundation
  32. instead of in the original English.
  33.  
  34. 
  35. File: gcc.info,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  36.  
  37. Options for Debugging Your Program or GCC
  38. =========================================
  39.  
  40.    GCC has various special options that are used for debugging either
  41. your program or GCC:
  42.  
  43. `-g'
  44.      Produce debugging information in the operating system's native
  45.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  46.      debugging information.
  47.  
  48.      On most systems that use stabs format, `-g' enables use of extra
  49.      debugging information that only GDB can use; this extra information
  50.      makes debugging work better in GDB but will probably make other
  51.      debuggers crash or refuse to read the program.  If you want to
  52.      control for certain whether to generate the extra information, use
  53.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf-1+', or
  54.      `-gdwarf-1' (see below).
  55.  
  56.      Unlike most other C compilers, GCC allows you to use `-g' with
  57.      `-O'.  The shortcuts taken by optimized code may occasionally
  58.      produce surprising results: some variables you declared may not
  59.      exist at all; flow of control may briefly move where you did not
  60.      expect it; some statements may not be executed because they
  61.      compute constant results or their values were already at hand;
  62.      some statements may execute in different places because they were
  63.      moved out of loops.
  64.  
  65.      Nevertheless it proves possible to debug optimized output.  This
  66.      makes it reasonable to use the optimizer for programs that might
  67.      have bugs.
  68.  
  69.      The following options are useful when GCC is generated with the
  70.      capability for more than one debugging format.
  71.  
  72. `-ggdb'
  73.      Produce debugging information for use by GDB.  This means to use
  74.      the most expressive format available (DWARF 2, stabs, or the
  75.      native format if neither of those are supported), including GDB
  76.      extensions if at all possible.
  77.  
  78. `-gstabs'
  79.      Produce debugging information in stabs format (if that is
  80.      supported), without GDB extensions.  This is the format used by
  81.      DBX on most BSD systems.  On MIPS, Alpha and System V Release 4
  82.      systems this option produces stabs debugging output which is not
  83.      understood by DBX or SDB.  On System V Release 4 systems this
  84.      option requires the GNU assembler.
  85.  
  86. `-gstabs+'
  87.      Produce debugging information in stabs format (if that is
  88.      supported), using GNU extensions understood only by the GNU
  89.      debugger (GDB).  The use of these extensions is likely to make
  90.      other debuggers crash or refuse to read the program.
  91.  
  92. `-gcoff'
  93.      Produce debugging information in COFF format (if that is
  94.      supported).  This is the format used by SDB on most System V
  95.      systems prior to System V Release 4.
  96.  
  97. `-gxcoff'
  98.      Produce debugging information in XCOFF format (if that is
  99.      supported).  This is the format used by the DBX debugger on IBM
  100.      RS/6000 systems.
  101.  
  102. `-gxcoff+'
  103.      Produce debugging information in XCOFF format (if that is
  104.      supported), using GNU extensions understood only by the GNU
  105.      debugger (GDB).  The use of these extensions is likely to make
  106.      other debuggers crash or refuse to read the program, and may cause
  107.      assemblers other than the GNU assembler (GAS) to fail with an
  108.      error.
  109.  
  110. `-gdwarf'
  111.      Produce debugging information in DWARF version 1 format (if that is
  112.      supported).  This is the format used by SDB on most System V
  113.      Release 4 systems.
  114.  
  115. `-gdwarf+'
  116.      Produce debugging information in DWARF version 1 format (if that is
  117.      supported), using GNU extensions understood only by the GNU
  118.      debugger (GDB).  The use of these extensions is likely to make
  119.      other debuggers crash or refuse to read the program.
  120.  
  121. `-gdwarf-2'
  122.      Produce debugging information in DWARF version 2 format (if that is
  123.      supported).  This is the format used by DBX on IRIX 6.
  124.  
  125. `-gLEVEL'
  126. `-ggdbLEVEL'
  127. `-gstabsLEVEL'
  128. `-gcoffLEVEL'
  129. `-gxcoffLEVEL'
  130. `-gdwarfLEVEL'
  131. `-gdwarf-2LEVEL'
  132.      Request debugging information and also use LEVEL to specify how
  133.      much information.  The default level is 2.
  134.  
  135.      Level 1 produces minimal information, enough for making backtraces
  136.      in parts of the program that you don't plan to debug.  This
  137.      includes descriptions of functions and external variables, but no
  138.      information about local variables and no line numbers.
  139.  
  140.      Level 3 includes extra information, such as all the macro
  141.      definitions present in the program.  Some debuggers support macro
  142.      expansion when you use `-g3'.
  143.  
  144. `-p'
  145.      Generate extra code to write profile information suitable for the
  146.      analysis program `prof'.  You must use this option when compiling
  147.      the source files you want data about, and you must also use it when
  148.      linking.
  149.  
  150. `-pg'
  151.      Generate extra code to write profile information suitable for the
  152.      analysis program `gprof'.  You must use this option when compiling
  153.      the source files you want data about, and you must also use it when
  154.      linking.
  155.  
  156. `-a'
  157.      Generate extra code to write profile information for basic blocks,
  158.      which will record the number of times each basic block is
  159.      executed, the basic block start address, and the function name
  160.      containing the basic block.  If `-g' is used, the line number and
  161.      filename of the start of the basic block will also be recorded.
  162.      If not overridden by the machine description, the default action is
  163.      to append to the text file `bb.out'.
  164.  
  165.      This data could be analyzed by a program like `tcov'.  Note,
  166.      however, that the format of the data is not what `tcov' expects.
  167.      Eventually GNU `gprof' should be extended to process this data.
  168.  
  169. `-Q'
  170.      Makes the compiler print out each function name as it is compiled,
  171.      and print some statistics about each pass when it finishes.
  172.  
  173. `-ax'
  174.      Generate extra code to profile basic blocks.  Your executable will
  175.      produce output that is a superset of that produced when `-a' is
  176.      used.  Additional output is the source and target address of the
  177.      basic blocks where a jump takes place, the number of times a jump
  178.      is executed, and (optionally) the complete sequence of basic
  179.      blocks being executed.  The output is appended to file `bb.out'.
  180.  
  181.      You can examine different profiling aspects without recompilation.
  182.      Your executable will read a list of function names from file
  183.      `bb.in'.  Profiling starts when a function on the list is entered
  184.      and stops when that invocation is exited.  To exclude a function
  185.      from profiling, prefix its name with `-'.  If a function name is
  186.      not unique, you can disambiguate it by writing it in the form
  187.      `/path/filename.d:functionname'.  Your executable will write the
  188.      available paths and filenames in file `bb.out'.
  189.  
  190.      Several function names have a special meaning:
  191.     `__bb_jumps__'
  192.           Write source, target and frequency of jumps to file `bb.out'.
  193.  
  194.     `__bb_hidecall__'
  195.           Exclude function calls from frequency count.
  196.  
  197.     `__bb_showret__'
  198.           Include function returns in frequency count.
  199.  
  200.     `__bb_trace__'
  201.           Write the sequence of basic blocks executed to file
  202.           `bbtrace.gz'.  The file will be compressed using the program
  203.           `gzip', which must exist in your `PATH'.  On systems without
  204.           the `popen' function, the file will be named `bbtrace' and
  205.           will not be compressed.  *Profiling for even a few seconds on
  206.           these systems will produce a very large file.*  Note:
  207.           `__bb_hidecall__' and `__bb_showret__' will not affect the
  208.           sequence written to `bbtrace.gz'.
  209.  
  210.      Here's a short example using different profiling parameters in
  211.      file `bb.in'.  Assume function `foo' consists of basic blocks 1
  212.      and 2 and is called twice from block 3 of function `main'.  After
  213.      the calls, block 3 transfers control to block 4 of `main'.
  214.  
  215.      With `__bb_trace__' and `main' contained in file `bb.in', the
  216.      following sequence of blocks is written to file `bbtrace.gz': 0 3
  217.      1 2 1 2 4.  The return from block 2 to block 3 is not shown,
  218.      because the return is to a point inside the block and not to the
  219.      top.  The block address 0 always indicates, that control is
  220.      transferred to the trace from somewhere outside the observed
  221.      functions.  With `-foo' added to `bb.in', the blocks of function
  222.      `foo' are removed from the trace, so only 0 3 4 remains.
  223.  
  224.      With `__bb_jumps__' and `main' contained in file `bb.in', jump
  225.      frequencies will be written to file `bb.out'.  The frequencies are
  226.      obtained by constructing a trace of blocks and incrementing a
  227.      counter for every neighbouring pair of blocks in the trace.  The
  228.      trace 0 3 1 2 1 2 4 displays the following frequencies:
  229.  
  230.           Jump from block 0x0 to block 0x3 executed 1 time(s)
  231.           Jump from block 0x3 to block 0x1 executed 1 time(s)
  232.           Jump from block 0x1 to block 0x2 executed 2 time(s)
  233.           Jump from block 0x2 to block 0x1 executed 1 time(s)
  234.           Jump from block 0x2 to block 0x4 executed 1 time(s)
  235.  
  236.      With `__bb_hidecall__', control transfer due to call instructions
  237.      is removed from the trace, that is the trace is cut into three
  238.      parts: 0 3 4, 0 1 2 and 0 1 2.  With `__bb_showret__', control
  239.      transfer due to return instructions is added to the trace.  The
  240.      trace becomes: 0 3 1 2 3 1 2 3 4.  Note, that this trace is not
  241.      the same, as the sequence written to `bbtrace.gz'.  It is solely
  242.      used for counting jump frequencies.
  243.  
  244. `-fprofile-arcs'
  245.      Instrument "arcs" during compilation.  For each function of your
  246.      program, GCC creates a program flow graph, then finds a spanning
  247.      tree for the graph.  Only arcs that are not on the spanning tree
  248.      have to be instrumented: the compiler adds code to count the
  249.      number of times that these arcs are executed.  When an arc is the
  250.      only exit or only entrance to a block, the instrumentation code
  251.      can be added to the block; otherwise, a new basic block must be
  252.      created to hold the instrumentation code.
  253.  
  254.      Since not every arc in the program must be instrumented, programs
  255.      compiled with this option run faster than programs compiled with
  256.      `-a', which adds instrumentation code to every basic block in the
  257.      program.  The tradeoff: since `gcov' does not have execution
  258.      counts for all branches, it must start with the execution counts
  259.      for the instrumented branches, and then iterate over the program
  260.      flow graph until the entire graph has been solved.  Hence, `gcov'
  261.      runs a little more slowly than a program which uses information
  262.      from `-a'.
  263.  
  264.      `-fprofile-arcs' also makes it possible to estimate branch
  265.      probabilities, and to calculate basic block execution counts.  In
  266.      general, basic block execution counts do not give enough
  267.      information to estimate all branch probabilities.  When the
  268.      compiled program exits, it saves the arc execution counts to a
  269.      file called `SOURCENAME.da'.  Use the compiler option
  270.      `-fbranch-probabilities' (*note Options that Control Optimization:
  271.      Optimize Options.) when recompiling, to optimize using estimated
  272.      branch probabilities.
  273.  
  274. `-ftest-coverage'
  275.      Create data files for the `gcov' code-coverage utility (*note
  276.      `gcov': a GCC Test Coverage Program: Gcov.).  The data file names
  277.      begin with the name of your source file:
  278.  
  279.     `SOURCENAME.bb'
  280.           A mapping from basic blocks to line numbers, which `gcov'
  281.           uses to associate basic block execution counts with line
  282.           numbers.
  283.  
  284.     `SOURCENAME.bbg'
  285.           A list of all arcs in the program flow graph.  This allows
  286.           `gcov' to reconstruct the program flow graph, so that it can
  287.           compute all basic block and arc execution counts from the
  288.           information in the `SOURCENAME.da' file (this last file is
  289.           the output from `-fprofile-arcs').
  290.  
  291. `-Q'
  292.      Makes the compiler print out each function name as it is compiled,
  293.      and print some statistics about each pass when it finishes.
  294.  
  295. `-dLETTERS'
  296.      Says to make debugging dumps during compilation at times specified
  297.      by LETTERS.  This is used for debugging the compiler.  The file
  298.      names for most of the dumps are made by appending a word to the
  299.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  300.      possible letters for use in LETTERS, and their meanings:
  301.  
  302.     `b'
  303.           Dump after computing branch probabilities, to `FILE.bp'.
  304.  
  305.     `c'
  306.           Dump after instruction combination, to the file
  307.           `FILE.combine'.
  308.  
  309.     `d'
  310.           Dump after delayed branch scheduling, to `FILE.dbr'.
  311.  
  312.     `D'
  313.           Dump all macro definitions, at the end of preprocessing, in
  314.           addition to normal output.
  315.  
  316.     `r'
  317.           Dump after RTL generation, to `FILE.rtl'.
  318.  
  319.     `j'
  320.           Dump after first jump optimization, to `FILE.jump'.
  321.  
  322.     `F'
  323.           Dump after purging ADDRESSOF, to `FILE.addressof'.
  324.  
  325.     `f'
  326.           Dump after flow analysis, to `FILE.flow'.
  327.  
  328.     `g'
  329.           Dump after global register allocation, to `FILE.greg'.
  330.  
  331.     `G'
  332.           Dump after GCSE, to `FILE.gcse'.
  333.  
  334.     `j'
  335.           Dump after first jump optimization, to `FILE.jump'.
  336.  
  337.     `J'
  338.           Dump after last jump optimization, to `FILE.jump2'.
  339.  
  340.     `k'
  341.           Dump after conversion from registers to stack, to
  342.           `FILE.stack'.
  343.  
  344.     `l'
  345.           Dump after local register allocation, to `FILE.lreg'.
  346.  
  347.     `L'
  348.           Dump after loop optimization, to `FILE.loop'.
  349.  
  350.     `M'
  351.           Dump after performing the machine dependent reorganisation
  352.           pass, to `FILE.mach'.
  353.  
  354.     `N'
  355.           Dump after the register move pass, to `FILE.regmove'.
  356.  
  357.     `r'
  358.           Dump after RTL generation, to `FILE.rtl'.
  359.  
  360.     `R'
  361.           Dump after the second instruction scheduling pass, to
  362.           `FILE.sched2'.
  363.  
  364.     `s'
  365.           Dump after CSE (including the jump optimization that
  366.           sometimes follows CSE), to `FILE.cse'.
  367.  
  368.     `S'
  369.           Dump after the first instruction scheduling pass, to
  370.           `FILE.sched'.
  371.  
  372.     `t'
  373.           Dump after the second CSE pass (including the jump
  374.           optimization that sometimes follows CSE), to `FILE.cse2'.
  375.  
  376.     `a'
  377.           Produce all the dumps listed above.
  378.  
  379.     `m'
  380.           Print statistics on memory usage, at the end of the run, to
  381.           standard error.
  382.  
  383.     `p'
  384.           Annotate the assembler output with a comment indicating which
  385.           pattern and alternative was used.  The length of each
  386.           instruction is also printed.
  387.  
  388.     `x'
  389.           Just generate RTL for a function instead of compiling it.
  390.           Usually used with `r'.
  391.  
  392.     `y'
  393.           Dump debugging information during parsing, to standard error.
  394.  
  395.     `A'
  396.           Annotate the assembler output with miscellaneous debugging
  397.           information.
  398.  
  399. `-fdump-unnumbered'
  400.      When doing debugging dumps (see -d option above), suppress
  401.      instruction numbers and line number note output.  This makes it
  402.      more feasible to use diff on debugging dumps for compiler
  403.      invokations with different options, in particular with and without
  404.      -g.
  405.  
  406. `-fpretend-float'
  407.      When running a cross-compiler, pretend that the target machine
  408.      uses the same floating point format as the host machine.  This
  409.      causes incorrect output of the actual floating constants, but the
  410.      actual instruction sequence will probably be the same as GCC would
  411.      make when running on the target machine.
  412.  
  413. `-save-temps'
  414.      Store the usual "temporary" intermediate files permanently; place
  415.      them in the current directory and name them based on the source
  416.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  417.      files `foo.i' and `foo.s', as well as `foo.o'.
  418.  
  419. `-print-file-name=LIBRARY'
  420.      Print the full absolute name of the library file LIBRARY that
  421.      would be used when linking--and don't do anything else.  With this
  422.      option, GCC does not compile or link anything; it just prints the
  423.      file name.
  424.  
  425. `-print-prog-name=PROGRAM'
  426.      Like `-print-file-name', but searches for a program such as `cpp'.
  427.  
  428. `-print-libgcc-file-name'
  429.      Same as `-print-file-name=libgcc.a'.
  430.  
  431.      This is useful when you use `-nostdlib' or `-nodefaultlibs' but
  432.      you do want to link with `libgcc.a'.  You can do
  433.  
  434.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  435.  
  436. `-print-search-dirs'
  437.      Print the name of the configured installation directory and a list
  438.      of program and library directories gcc will search--and don't do
  439.      anything else.
  440.  
  441.      This is useful when gcc prints the error message `installation
  442.      problem, cannot exec cpp: No such file or directory'.  To resolve
  443.      this you either need to put `cpp' and the other compiler
  444.      components where gcc expects to find them, or you can set the
  445.      environment variable `GCC_EXEC_PREFIX' to the directory where you
  446.      installed them.  Don't forget the trailing '/'.  *Note Environment
  447.      Variables::.
  448.  
  449. 
  450. File: gcc.info,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  451.  
  452. Options That Control Optimization
  453. =================================
  454.  
  455.    These options control various sorts of optimizations:
  456.  
  457. `-O'
  458. `-O1'
  459.      Optimize.  Optimizing compilation takes somewhat more time, and a
  460.      lot more memory for a large function.
  461.  
  462.      Without `-O', the compiler's goal is to reduce the cost of
  463.      compilation and to make debugging produce the expected results.
  464.      Statements are independent: if you stop the program with a
  465.      breakpoint between statements, you can then assign a new value to
  466.      any variable or change the program counter to any other statement
  467.      in the function and get exactly the results you would expect from
  468.      the source code.
  469.  
  470.      Without `-O', the compiler only allocates variables declared
  471.      `register' in registers.  The resulting compiled code is a little
  472.      worse than produced by PCC without `-O'.
  473.  
  474.      With `-O', the compiler tries to reduce code size and execution
  475.      time.
  476.  
  477.      When you specify `-O', the compiler turns on `-fthread-jumps' and
  478.      `-fdefer-pop' on all machines.  The compiler turns on
  479.      `-fdelayed-branch' on machines that have delay slots, and
  480.      `-fomit-frame-pointer' on machines that can support debugging even
  481.      without a frame pointer.  On some machines the compiler also turns
  482.      on other flags.
  483.  
  484. `-O2'
  485.      Optimize even more.  GCC performs nearly all supported
  486.      optimizations that do not involve a space-speed tradeoff.  The
  487.      compiler does not perform loop unrolling or function inlining when
  488.      you specify `-O2'.  As compared to `-O', this option increases
  489.      both compilation time and the performance of the generated code.
  490.  
  491.      `-O2' turns on all optional optimizations except for loop
  492.      unrolling, function inlining, and strict aliasing optimizations.
  493.      It also turns on the `-fforce-mem' option on all machines and
  494.      frame pointer elimination on machines where doing so does not
  495.      interfere with debugging.
  496.  
  497. `-O3'
  498.      Optimize yet more.  `-O3' turns on all optimizations specified by
  499.      `-O2' and also turns on the `inline-functions' option.
  500.  
  501. `-O0'
  502.      Do not optimize.
  503.  
  504. `-Os'
  505.      Optimize for size.  `-Os' enables all `-O2' optimizations that do
  506.      not typically increase code size.  It also performs further
  507.      optimizations designed to reduce code size.
  508.  
  509.      If you use multiple `-O' options, with or without level numbers,
  510.      the last such option is the one that is effective.
  511.  
  512.    Options of the form `-fFLAG' specify machine-independent flags.
  513. Most flags have both positive and negative forms; the negative form of
  514. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  515. is listed--the one which is not the default.  You can figure out the
  516. other form by either removing `no-' or adding it.
  517.  
  518. `-ffloat-store'
  519.      Do not store floating point variables in registers, and inhibit
  520.      other options that might change whether a floating point value is
  521.      taken from a register or memory.
  522.  
  523.      This option prevents undesirable excess precision on machines such
  524.      as the 68000 where the floating registers (of the 68881) keep more
  525.      precision than a `double' is supposed to have.  Similarly for the
  526.      x86 architecture.  For most programs, the excess precision does
  527.      only good, but a few programs rely on the precise definition of
  528.      IEEE floating point.  Use `-ffloat-store' for such programs, after
  529.      modifying them to store all pertinent intermediate computations
  530.      into variables.
  531.  
  532. `-fno-default-inline'
  533.      Do not make member functions inline by default merely because they
  534.      are defined inside the class scope (C++ only).  Otherwise, when
  535.      you specify `-O', member functions defined inside class scope are
  536.      compiled inline by default; i.e., you don't need to add `inline'
  537.      in front of the member function name.
  538.  
  539. `-fno-defer-pop'
  540.      Always pop the arguments to each function call as soon as that
  541.      function returns.  For machines which must pop arguments after a
  542.      function call, the compiler normally lets arguments accumulate on
  543.      the stack for several function calls and pops them all at once.
  544.  
  545. `-fforce-mem'
  546.      Force memory operands to be copied into registers before doing
  547.      arithmetic on them.  This produces better code by making all memory
  548.      references potential common subexpressions.  When they are not
  549.      common subexpressions, instruction combination should eliminate
  550.      the separate register-load.  The `-O2' option turns on this option.
  551.  
  552. `-fforce-addr'
  553.      Force memory address constants to be copied into registers before
  554.      doing arithmetic on them.  This may produce better code just as
  555.      `-fforce-mem' may.
  556.  
  557. `-fomit-frame-pointer'
  558.      Don't keep the frame pointer in a register for functions that
  559.      don't need one.  This avoids the instructions to save, set up and
  560.      restore frame pointers; it also makes an extra register available
  561.      in many functions.  *It also makes debugging impossible on some
  562.      machines.*
  563.  
  564.      On some machines, such as the Vax, this flag has no effect, because
  565.      the standard calling sequence automatically handles the frame
  566.      pointer and nothing is saved by pretending it doesn't exist.  The
  567.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  568.      whether a target machine supports this flag.  *Note Registers::.
  569.  
  570. `-fno-inline'
  571.      Don't pay attention to the `inline' keyword.  Normally this option
  572.      is used to keep the compiler from expanding any functions inline.
  573.      Note that if you are not optimizing, no functions can be expanded
  574.      inline.
  575.  
  576. `-finline-functions'
  577.      Integrate all simple functions into their callers.  The compiler
  578.      heuristically decides which functions are simple enough to be worth
  579.      integrating in this way.
  580.  
  581.      If all calls to a given function are integrated, and the function
  582.      is declared `static', then the function is normally not output as
  583.      assembler code in its own right.
  584.  
  585. `-finline-limit-N'
  586.      By default, gcc limits the size of functions that can be inlined.
  587.      This flag allows the control of this limit for functions that are
  588.      explicitly marked as inline (ie marked with the inline keyword or
  589.      defined within the class definition in c++).  N is the size of
  590.      functions that can be inlined in number of pseudo instructions
  591.      (not counting parameter handling).  The default value of n is
  592.      10000.  Increasing this value can result in more inlined code at
  593.      the cost of compilation time and memory consumption.  Decreasing
  594.      usually makes the compilation faster and less code will be inlined
  595.      (which presumably means slower programs).  This option is
  596.      particularly useful for programs that use inlining heavily such as
  597.      those based on recursive templates with c++.
  598.  
  599.      *Note:* pseudo instruction represents, in this particular context,
  600.      an abstract measurement of function's size.  In no way, it
  601.      represents a count of assembly instructions and as such its exact
  602.      meaning might change from one release to an another.
  603.  
  604. `-fkeep-inline-functions'
  605.      Even if all calls to a given function are integrated, and the
  606.      function is declared `static', nevertheless output a separate
  607.      run-time callable version of the function.  This switch does not
  608.      affect `extern inline' functions.
  609.  
  610. `-fkeep-static-consts'
  611.      Emit variables declared `static const' when optimization isn't
  612.      turned on, even if the variables aren't referenced.
  613.  
  614.      GCC enables this option by default.  If you want to force the
  615.      compiler to check if the variable was referenced, regardless of
  616.      whether or not optimization is turned on, use the
  617.      `-fno-keep-static-consts' option.
  618.  
  619. `-fno-function-cse'
  620.      Do not put function addresses in registers; make each instruction
  621.      that calls a constant function contain the function's address
  622.      explicitly.
  623.  
  624.      This option results in less efficient code, but some strange hacks
  625.      that alter the assembler output may be confused by the
  626.      optimizations performed when this option is not used.
  627.  
  628. `-ffast-math'
  629.      This option allows GCC to violate some ANSI or IEEE rules and/or
  630.      specifications in the interest of optimizing code for speed.  For
  631.      example, it allows the compiler to assume arguments to the `sqrt'
  632.      function are non-negative numbers and that no floating-point values
  633.      are NaNs.
  634.  
  635.      This option should never be turned on by any `-O' option since it
  636.      can result in incorrect output for programs which depend on an
  637.      exact implementation of IEEE or ANSI rules/specifications for math
  638.      functions.
  639.  
  640.    The following options control specific optimizations.  The `-O2'
  641. option turns on all of these optimizations except `-funroll-loops'
  642. `-funroll-all-loops', and `-fstrict-aliasing'.  On most machines, the
  643. `-O' option turns on the `-fthread-jumps' and `-fdelayed-branch'
  644. options, but specific machines may handle it differently.
  645.  
  646.    You can use the following flags in the rare cases when "fine-tuning"
  647. of optimizations to be performed is desired.
  648.  
  649. `-fstrength-reduce'
  650.      Perform the optimizations of loop strength reduction and
  651.      elimination of iteration variables.
  652.  
  653. `-fthread-jumps'
  654.      Perform optimizations where we check to see if a jump branches to a
  655.      location where another comparison subsumed by the first is found.
  656.      If so, the first branch is redirected to either the destination of
  657.      the second branch or a point immediately following it, depending
  658.      on whether the condition is known to be true or false.
  659.  
  660. `-fcse-follow-jumps'
  661.      In common subexpression elimination, scan through jump instructions
  662.      when the target of the jump is not reached by any other path.  For
  663.      example, when CSE encounters an `if' statement with an `else'
  664.      clause, CSE will follow the jump when the condition tested is
  665.      false.
  666.  
  667. `-fcse-skip-blocks'
  668.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  669.      jumps which conditionally skip over blocks.  When CSE encounters a
  670.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  671.      causes CSE to follow the jump around the body of the `if'.
  672.  
  673. `-frerun-cse-after-loop'
  674.      Re-run common subexpression elimination after loop optimizations
  675.      has been performed.
  676.  
  677. `-frerun-loop-opt'
  678.      Run the loop optimizer twice.
  679.  
  680. `-fgcse'
  681.      Perform a global common subexpression elimination pass.  This pass
  682.      also performs global constant and copy propagation.
  683.  
  684. `-fexpensive-optimizations'
  685.      Perform a number of minor optimizations that are relatively
  686.      expensive.
  687.  
  688. `-foptimize-register-moves'
  689. `-fregmove'
  690.      Attempt to reassign register numbers in move instructions and as
  691.      operands of other simple instructions in order to maximize the
  692.      amount of register tying.  This is especially helpful on machines
  693.      with two-operand instructions.  GCC enables this optimization by
  694.      default with `-O2' or higher.
  695.  
  696.      Note `-fregmove' and `-foptimize-register-moves' are the same
  697.      optimization.
  698.  
  699. `-fdelayed-branch'
  700.      If supported for the target machine, attempt to reorder
  701.      instructions to exploit instruction slots available after delayed
  702.      branch instructions.
  703.  
  704. `-fschedule-insns'
  705.      If supported for the target machine, attempt to reorder
  706.      instructions to eliminate execution stalls due to required data
  707.      being unavailable.  This helps machines that have slow floating
  708.      point or memory load instructions by allowing other instructions
  709.      to be issued until the result of the load or floating point
  710.      instruction is required.
  711.  
  712. `-fschedule-insns2'
  713.      Similar to `-fschedule-insns', but requests an additional pass of
  714.      instruction scheduling after register allocation has been done.
  715.      This is especially useful on machines with a relatively small
  716.      number of registers and where memory load instructions take more
  717.      than one cycle.
  718.  
  719. `-ffunction-sections'
  720. `-fdata-sections'
  721.      Place each function or data item into its own section in the output
  722.      file if the target supports arbitrary sections.  The name of the
  723.      function or the name of the data item determines the section's name
  724.      in the output file.
  725.  
  726.      Use these options on systems where the linker can perform
  727.      optimizations to improve locality of reference in the instruction
  728.      space.  HPPA processors running HP-UX and Sparc processors running
  729.      Solaris 2 have linkers with such optimizations.  Other systems
  730.      using the ELF object format as well as AIX may have these
  731.      optimizations in the future.
  732.  
  733.      Only use these options when there are significant benefits from
  734.      doing so.  When you specify these options, the assembler and
  735.      linker will create larger object and executable files and will
  736.      also be slower.  You will not be able to use `gprof' on all
  737.      systems if you specify this option and you may have problems with
  738.      debugging if you specify both this option and `-g'.
  739.  
  740. `-fcaller-saves'
  741.      Enable values to be allocated in registers that will be clobbered
  742.      by function calls, by emitting extra instructions to save and
  743.      restore the registers around such calls.  Such allocation is done
  744.      only when it seems to result in better code than would otherwise
  745.      be produced.
  746.  
  747.      This option is always enabled by default on certain machines,
  748.      usually those which have no call-preserved registers to use
  749.      instead.
  750.  
  751.      For all machines, optimization level 2 and higher enables this
  752.      flag by default.
  753.  
  754. `-funroll-loops'
  755.      Perform the optimization of loop unrolling.  This is only done for
  756.      loops whose number of iterations can be determined at compile time
  757.      or run time.  `-funroll-loops' implies both `-fstrength-reduce' and
  758.      `-frerun-cse-after-loop'.
  759.  
  760. `-funroll-all-loops'
  761.      Perform the optimization of loop unrolling.  This is done for all
  762.      loops and usually makes programs run more slowly.
  763.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  764.      `-frerun-cse-after-loop'.
  765.  
  766. `-fmove-all-movables'
  767.      Forces all invariant computations in loops to be moved outside the
  768.      loop.
  769.  
  770. `-freduce-all-givs'
  771.      Forces all general-induction variables in loops to be
  772.      strength-reduced.
  773.  
  774.      *Note:* When compiling programs written in Fortran,
  775.      `-fmove-all-movables' and `-freduce-all-givs' are enabled by
  776.      default when you use the optimizer.
  777.  
  778.      These options may generate better or worse code; results are highly
  779.      dependent on the structure of loops within the source code.
  780.  
  781.      These two options are intended to be removed someday, once they
  782.      have helped determine the efficacy of various approaches to
  783.      improving loop optimizations.
  784.  
  785.      Please let us (`gcc@gcc.gnu.org' and `fortran@gnu.org') know how
  786.      use of these options affects the performance of your production
  787.      code.  We're very interested in code that runs *slower* when these
  788.      options are *enabled*.
  789.  
  790. `-fno-peephole'
  791.      Disable any machine-specific peephole optimizations.
  792.  
  793. `-fbranch-probabilities'
  794.      After running a program compiled with `-fprofile-arcs' (*note
  795.      Options for Debugging Your Program or `gcc': Debugging Options.),
  796.      you can compile it a second time using `-fbranch-probabilities',
  797.      to improve optimizations based on guessing the path a branch might
  798.      take.
  799.  
  800.      With `-fbranch-probabilities', GCC puts a `REG_EXEC_COUNT' note on
  801.      the first instruction of each basic block, and a `REG_BR_PROB'
  802.      note on each `JUMP_INSN' and `CALL_INSN'.  These can be used to
  803.      improve optimization.  Currently, they are only used in one place:
  804.      in `reorg.c', instead of guessing which path a branch is mostly to
  805.      take, the `REG_BR_PROB' values are used to exactly determine which
  806.      path is taken more often.
  807.  
  808. `-fstrict-aliasing'
  809.      Allows the compiler to assume the strictest aliasing rules
  810.      applicable to the language being compiled.  For C (and C++), this
  811.      activates optimizations based on the type of expressions.  In
  812.      particular, an object of one type is assumed never to reside at
  813.      the same address as an object of a different type, unless the
  814.      types are almost the same.  For example, an `unsigned int' can
  815.      alias an `int', but not a `void*' or a `double'.  A character type
  816.      may alias any other type.
  817.  
  818.      Pay special attention to code like this:
  819.           union a_union {
  820.             int i;
  821.             double d;
  822.           };
  823.           
  824.           int f() {
  825.             a_union t;
  826.             t.d = 3.0;
  827.             return t.i;
  828.           }
  829.      The practice of reading from a different union member than the one
  830.      most recently written to (called "type-punning") is common.  Even
  831.      with `-fstrict-aliasing', type-punning is allowed, provided the
  832.      memory is accessed through the union type.  So, the code above
  833.      will work as expected.  However, this code might not:
  834.           int f() {
  835.             a_union t;
  836.             int* ip;
  837.             t.d = 3.0;
  838.             ip = &t.i;
  839.             return *ip;
  840.           }
  841.  
  842.      Every language that wishes to perform language-specific alias
  843.      analysis should define a function that computes, given an `tree'
  844.      node, an alias set for the node.  Nodes in different alias sets
  845.      are not allowed to alias.  For an example, see the C front-end
  846.      function `c_get_alias_set'.
  847.  
  848. 
  849. File: gcc.info,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  850.  
  851. Options Controlling the Preprocessor
  852. ====================================
  853.  
  854.    These options control the C preprocessor, which is run on each C
  855. source file before actual compilation.
  856.  
  857.    If you use the `-E' option, nothing is done except preprocessing.
  858. Some of these options make sense only together with `-E' because they
  859. cause the preprocessor output to be unsuitable for actual compilation.
  860.  
  861. `-include FILE'
  862.      Process FILE as input before processing the regular input file.
  863.      In effect, the contents of FILE are compiled first.  Any `-D' and
  864.      `-U' options on the command line are always processed before
  865.      `-include FILE', regardless of the order in which they are
  866.      written.  All the `-include' and `-imacros' options are processed
  867.      in the order in which they are written.
  868.  
  869. `-imacros FILE'
  870.      Process FILE as input, discarding the resulting output, before
  871.      processing the regular input file.  Because the output generated
  872.      from FILE is discarded, the only effect of `-imacros FILE' is to
  873.      make the macros defined in FILE available for use in the main
  874.      input.
  875.  
  876.      Any `-D' and `-U' options on the command line are always processed
  877.      before `-imacros FILE', regardless of the order in which they are
  878.      written.  All the `-include' and `-imacros' options are processed
  879.      in the order in which they are written.
  880.  
  881. `-idirafter DIR'
  882.      Add the directory DIR to the second include path.  The directories
  883.      on the second include path are searched when a header file is not
  884.      found in any of the directories in the main include path (the one
  885.      that `-I' adds to).
  886.  
  887. `-iprefix PREFIX'
  888.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  889.  
  890. `-iwithprefix DIR'
  891.      Add a directory to the second include path.  The directory's name
  892.      is made by concatenating PREFIX and DIR, where PREFIX was
  893.      specified previously with `-iprefix'.  If you have not specified a
  894.      prefix yet, the directory containing the installed passes of the
  895.      compiler is used as the default.
  896.  
  897. `-iwithprefixbefore DIR'
  898.      Add a directory to the main include path.  The directory's name is
  899.      made by concatenating PREFIX and DIR, as in the case of
  900.      `-iwithprefix'.
  901.  
  902. `-isystem DIR'
  903.      Add a directory to the beginning of the second include path,
  904.      marking it as a system directory, so that it gets the same special
  905.      treatment as is applied to the standard system directories.
  906.  
  907. `-nostdinc'
  908.      Do not search the standard system directories for header files.
  909.      Only the directories you have specified with `-I' options (and the
  910.      current directory, if appropriate) are searched.  *Note Directory
  911.      Options::, for information on `-I'.
  912.  
  913.      By using both `-nostdinc' and `-I-', you can limit the include-file
  914.      search path to only those directories you specify explicitly.
  915.  
  916. `-undef'
  917.      Do not predefine any nonstandard macros.  (Including architecture
  918.      flags).
  919.  
  920. `-E'
  921.      Run only the C preprocessor.  Preprocess all the C source files
  922.      specified and output the results to standard output or to the
  923.      specified output file.
  924.  
  925. `-C'
  926.      Tell the preprocessor not to discard comments.  Used with the `-E'
  927.      option.
  928.  
  929. `-P'
  930.      Tell the preprocessor not to generate `#line' directives.  Used
  931.      with the `-E' option.
  932.  
  933. `-M'
  934.      Tell the preprocessor to output a rule suitable for `make'
  935.      describing the dependencies of each object file.  For each source
  936.      file, the preprocessor outputs one `make'-rule whose target is the
  937.      object file name for that source file and whose dependencies are
  938.      all the `#include' header files it uses.  This rule may be a
  939.      single line or may be continued with `\'-newline if it is long.
  940.      The list of rules is printed on standard output instead of the
  941.      preprocessed C program.
  942.  
  943.      `-M' implies `-E'.
  944.  
  945.      Another way to specify output of a `make' rule is by setting the
  946.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  947.      Variables::.).
  948.  
  949. `-MM'
  950.      Like `-M' but the output mentions only the user header files
  951.      included with `#include "FILE"'.  System header files included
  952.      with `#include <FILE>' are omitted.
  953.  
  954. `-MD'
  955.      Like `-M' but the dependency information is written to a file made
  956.      by replacing ".c" with ".d" at the end of the input file names.
  957.      This is in addition to compiling the file as specified--`-MD' does
  958.      not inhibit ordinary compilation the way `-M' does.
  959.  
  960.      In Mach, you can use the utility `md' to merge multiple dependency
  961.      files into a single dependency file suitable for using with the
  962.      `make' command.
  963.  
  964. `-MMD'
  965.      Like `-MD' except mention only user header files, not system
  966.      header files.
  967.  
  968. `-MG'
  969.      Treat missing header files as generated files and assume they live
  970.      in the same directory as the source file.  If you specify `-MG',
  971.      you must also specify either `-M' or `-MM'.  `-MG' is not
  972.      supported with `-MD' or `-MMD'.
  973.  
  974. `-H'
  975.      Print the name of each header file used, in addition to other
  976.      normal activities.
  977.  
  978. `-AQUESTION(ANSWER)'
  979.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  980.      preprocessing conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  981.      disables the standard assertions that normally describe the target
  982.      machine.
  983.  
  984. `-DMACRO'
  985.      Define macro MACRO with the string `1' as its definition.
  986.  
  987. `-DMACRO=DEFN'
  988.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  989.      line are processed before any `-U' options.
  990.  
  991. `-UMACRO'
  992.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  993.      options, but before any `-include' and `-imacros' options.
  994.  
  995. `-dM'
  996.      Tell the preprocessor to output only a list of the macro
  997.      definitions that are in effect at the end of preprocessing.  Used
  998.      with the `-E' option.
  999.  
  1000. `-dD'
  1001.      Tell the preprocessing to pass all macro definitions into the
  1002.      output, in their proper sequence in the rest of the output.
  1003.  
  1004. `-dN'
  1005.      Like `-dD' except that the macro arguments and contents are
  1006.      omitted.  Only `#define NAME' is included in the output.
  1007.  
  1008. `-trigraphs'
  1009.      Support ANSI C trigraphs.  The `-ansi' option also has this effect.
  1010.  
  1011. `-Wp,OPTION'
  1012.      Pass OPTION as an option to the preprocessor.  If OPTION contains
  1013.      commas, it is split into multiple options at the commas.
  1014.  
  1015. 
  1016. File: gcc.info,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  1017.  
  1018. Passing Options to the Assembler
  1019. ================================
  1020.  
  1021.    You can pass options to the assembler.
  1022.  
  1023. `-Wa,OPTION'
  1024.      Pass OPTION as an option to the assembler.  If OPTION contains
  1025.      commas, it is split into multiple options at the commas.
  1026.  
  1027. 
  1028. File: gcc.info,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  1029.  
  1030. Options for Linking
  1031. ===================
  1032.  
  1033.    These options come into play when the compiler links object files
  1034. into an executable output file.  They are meaningless if the compiler is
  1035. not doing a link step.
  1036.  
  1037. `OBJECT-FILE-NAME'
  1038.      A file name that does not end in a special recognized suffix is
  1039.      considered to name an object file or library.  (Object files are
  1040.      distinguished from libraries by the linker according to the file
  1041.      contents.)  If linking is done, these object files are used as
  1042.      input to the linker.
  1043.  
  1044. `-c'
  1045. `-S'
  1046. `-E'
  1047.      If any of these options is used, then the linker is not run, and
  1048.      object file names should not be used as arguments.  *Note Overall
  1049.      Options::.
  1050.  
  1051. `-lLIBRARY'
  1052.      Search the library named LIBRARY when linking.
  1053.  
  1054.      It makes a difference where in the command you write this option;
  1055.      the linker searches processes libraries and object files in the
  1056.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  1057.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  1058.      refers to functions in `z', those functions may not be loaded.
  1059.  
  1060.      The linker searches a standard list of directories for the library,
  1061.      which is actually a file named `libLIBRARY.a'.  The linker then
  1062.      uses this file as if it had been specified precisely by name.
  1063.  
  1064.      The directories searched include several standard system
  1065.      directories plus any that you specify with `-L'.
  1066.  
  1067.      Normally the files found this way are library files--archive files
  1068.      whose members are object files.  The linker handles an archive
  1069.      file by scanning through it for members which define symbols that
  1070.      have so far been referenced but not defined.  But if the file that
  1071.      is found is an ordinary object file, it is linked in the usual
  1072.      fashion.  The only difference between using an `-l' option and
  1073.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  1074.      and `.a' and searches several directories.
  1075.  
  1076. `-lobjc'
  1077.      You need this special case of the `-l' option in order to link an
  1078.      Objective C program.
  1079.  
  1080. `-nostartfiles'
  1081.      Do not use the standard system startup files when linking.  The
  1082.      standard system libraries are used normally, unless `-nostdlib' or
  1083.      `-nodefaultlibs' is used.
  1084.  
  1085. `-nodefaultlibs'
  1086.      Do not use the standard system libraries when linking.  Only the
  1087.      libraries you specify will be passed to the linker.  The standard
  1088.      startup files are used normally, unless `-nostartfiles' is used.
  1089.      The compiler may generate calls to memcmp, memset, and memcpy for
  1090.      System V (and ANSI C) environments or to bcopy and bzero for BSD
  1091.      environments.  These entries are usually resolved by entries in
  1092.      libc.  These entry points should be supplied through some other
  1093.      mechanism when this option is specified.
  1094.  
  1095. `-nostdlib'
  1096.      Do not use the standard system startup files or libraries when
  1097.      linking.  No startup files and only the libraries you specify will
  1098.      be passed to the linker. The compiler may generate calls to
  1099.      memcmp, memset, and memcpy for System V (and ANSI C) environments
  1100.      or to bcopy and bzero for BSD environments.  These entries are
  1101.      usually resolved by entries in libc.  These entry points should be
  1102.      supplied through some other mechanism when this option is
  1103.      specified.
  1104.  
  1105.      One of the standard libraries bypassed by `-nostdlib' and
  1106.      `-nodefaultlibs' is `libgcc.a', a library of internal subroutines
  1107.      that GCC uses to overcome shortcomings of particular machines, or
  1108.      special needs for some languages.  (*Note Interfacing to GCC
  1109.      Output: Interface, for more discussion of `libgcc.a'.)  In most
  1110.      cases, you need `libgcc.a' even when you want to avoid other
  1111.      standard libraries.  In other words, when you specify `-nostdlib'
  1112.      or `-nodefaultlibs' you should usually specify `-lgcc' as well.
  1113.      This ensures that you have no unresolved references to internal GCC
  1114.      library subroutines.  (For example, `__main', used to ensure C++
  1115.      constructors will be called; *note `collect2': Collect2..)
  1116.  
  1117. `-s'
  1118.      Remove all symbol table and relocation information from the
  1119.      executable.
  1120.  
  1121. `-static'
  1122.      On systems that support dynamic linking, this prevents linking
  1123.      with the shared libraries.  On other systems, this option has no
  1124.      effect.
  1125.  
  1126. `-shared'
  1127.      Produce a shared object which can then be linked with other
  1128.      objects to form an executable.  Not all systems support this
  1129.      option.  You must also specify `-fpic' or `-fPIC' on some systems
  1130.      when you specify this option.
  1131.  
  1132. `-symbolic'
  1133.      Bind references to global symbols when building a shared object.
  1134.      Warn about any unresolved references (unless overridden by the
  1135.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  1136.      systems support this option.
  1137.  
  1138. `-Xlinker OPTION'
  1139.      Pass OPTION as an option to the linker.  You can use this to
  1140.      supply system-specific linker options which GCC does not know how
  1141.      to recognize.
  1142.  
  1143.      If you want to pass an option that takes an argument, you must use
  1144.      `-Xlinker' twice, once for the option and once for the argument.
  1145.      For example, to pass `-assert definitions', you must write
  1146.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  1147.      `-Xlinker "-assert definitions"', because this passes the entire
  1148.      string as a single argument, which is not what the linker expects.
  1149.  
  1150. `-Wl,OPTION'
  1151.      Pass OPTION as an option to the linker.  If OPTION contains
  1152.      commas, it is split into multiple options at the commas.
  1153.  
  1154. `-u SYMBOL'
  1155.      Pretend the symbol SYMBOL is undefined, to force linking of
  1156.      library modules to define it.  You can use `-u' multiple times with
  1157.      different symbols to force loading of additional library modules.
  1158.  
  1159.